package com.xauto.pioneer.appuser.model;

import org.json.JSONObject;

/**
 * 取车网点
 * Created by Lemon on 27/02/2017.
 */
public class ParkingSite extends BaseModel<ParkingSite> {

    /** 网点ID*/
    public String parking_site_id;
    /** 网点编号*/
    public String parking_site_no;
    /** 网点名称*/
    public String parking_site_name;
    /** 进站费用*/
    public String enter_expense;
    /** 取车费用*/
    public String departure_expense;
    /** 网点图片*/
    public Image parking_site_image=null;
    /** 经度*/
    public double longitude_num;
    /** 纬度*/
    public double latitude_num;
    /** 可用车辆数量*/
    public int usable_car_count;
    /** 距离(单位:米)*/
    public String distance;
    /** 距离格式化*/
    public String distance_format;
    /** 地址*/
    public String address;
    /** 可用车位数（还车信息用）*/
    public int usable_space_count;
    public ParkingSite() {
        super();

    }


    @Override
    public ParkingSite parse(JSONObject jsonObject) {
        if(jsonObject != null) {
            parking_site_id = jsonObject.optString("parking_site_id");
            parking_site_no = jsonObject.optString("parking_site_no");
            enter_expense = jsonObject.optString("enter_expense");
            departure_expense = jsonObject.optString("departure_expense");
            parking_site_name = jsonObject.optString("parking_site_name");
            parking_site_image = new Image().parse(jsonObject.optJSONObject("parking_site_image"));
            longitude_num = jsonObject.optDouble("longitude_num");
            latitude_num = jsonObject.optDouble("latitude_num");
            usable_car_count = jsonObject.optInt("usable_car_count");
            distance = jsonObject.optString("distance");
            distance_format = jsonObject.optString("distance_format");
            address = jsonObject.optString("address");
            usable_space_count = jsonObject.optInt("usable_space_count");
            return this;
        }
        return null;
    }

    public String getParking_site_id() {
        return parking_site_id;
    }

    public void setParking_site_id(String parking_site_id) {
        this.parking_site_id = parking_site_id;
    }

    public String getParking_site_no() {
        return parking_site_no;
    }

    public void setParking_site_no(String parking_site_no) {
        this.parking_site_no = parking_site_no;
    }

    public String getParking_site_name() {
        return parking_site_name;
    }

    public void setParking_site_name(String parking_site_name) {
        this.parking_site_name = parking_site_name;
    }

    public Image getParking_site_image() {
        return parking_site_image;
    }

    public void setParking_site_image(Image parking_site_image) {
        this.parking_site_image = parking_site_image;
    }

    public double getLongitude_num() {
        return longitude_num;
    }

    public void setLongitude_num(double longitude_num) {
        this.longitude_num = longitude_num;
    }

    public double getLatitude_num() {
        return latitude_num;
    }

    public void setLatitude_num(double latitude_num) {
        this.latitude_num = latitude_num;
    }

    public int getUsable_car_count() {
        return usable_car_count;
    }

    public void setUsable_car_count(int usable_car_count) {
        this.usable_car_count = usable_car_count;
    }

    public String getDistance() {
        return distance;
    }

    public void setDistance(String distance) {
        this.distance = distance;
    }

    public String getDistance_format() {
        return distance_format;
    }

    public void setDistance_format(String distance_format) {
        this.distance_format = distance_format;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getUsable_space_count() {
        return usable_space_count;
    }

    public void setUsable_space_count(int usable_space_count) {
        this.usable_space_count = usable_space_count;
    }

    @Override
    public String toString() {
        return "ParkingSite{" +
                "parking_site_id='" + parking_site_id + '\'' +
                ", parking_site_no='" + parking_site_no + '\'' +
                ", parking_site_name='" + parking_site_name + '\'' +
                ", parking_site_image=" + parking_site_image +
                ", longitude_num=" + longitude_num +
                ", latitude_num=" + latitude_num +
                ", usable_car_count=" + usable_car_count +
                ", distance='" + distance + '\'' +
                ", distance_format='" + distance_format + '\'' +
                ", address='" + address + '\'' +
                '}';
    }
}
